home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Graphics / Viewers / aa_m68k_Intel_Only / ToyViewer1.2 / Source / common.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-12  |  2.0 KB  |  86 lines

  1. /*
  2.     common.h    image independent information
  3.  
  4.     Ver.1.0   1995-09-02  T.Ogihara
  5. */
  6.  
  7. #ifndef _COMMON_h_
  8. #define _COMMON_h_
  9.  
  10. #include <appkit/graphics.h>
  11. #include <stdio.h>
  12.  
  13. #define  Err_OPEN    1
  14. #define  Err_FORMAT    2
  15. #define  Err_MEMORY    3
  16. #define  Err_SHORT    4
  17. #define  Err_ILLG    5
  18. #define  Err_IMPLEMENT    6
  19. #define  Err_SAVE    7
  20. #define  Err_SAV_IMPL    8
  21. #define  Err_EPS_IMPL    9
  22. #define  Err_NOFILE    10
  23.  
  24. #define  Type_none    -1
  25. #define  Type_other    0    /* Filter service */
  26. #define  Type_tiff    1
  27. #define  Type_eps    2
  28. #define  Type_gif    3
  29. #define  Type_bmp    4
  30. #define  Type_ppm    5
  31. #define  Type_pcd    6
  32. #define  Type_user    0x11    /* User-specified pipe */
  33. #define  Type_pcx    0x12
  34. #define  Type_mag    0x13
  35. #define  Type_jpg    0x14
  36. #define  viaPipe(t)    ((t) > 0 && (0xf0 & (t)))
  37.  
  38. #define  toyviewerTAB    "filters"
  39. #define  toyviewerRC    ".toyviewerrc"
  40.  
  41. #define  RED    0
  42. #define  GREEN    1
  43. #define  BLUE    2
  44. #define  ALPHA    3
  45. #define  FIXcount    256
  46.  
  47. #define  Horizontal    -1
  48. #define  Vertical    -2
  49. #define  Negative    -3
  50. #define  Clip        -4
  51.  
  52. #define  MAXWidth    4096    /* †Łˋþ⁄˛†£²ÿ⁄˛ˋ瘌”˙´ñˆ˝ */
  53. #define  MAX_COMMENT    256
  54.  
  55. typedef unsigned char    paltype[3];
  56.  
  57. typedef struct {
  58.     int    width, height;
  59.     short    xbytes;        /* ¥—¥⁄¥¨¿û/line */
  60.     short    palsteps;    /* colors of palette */
  61.     unsigned char    type;    /* Type_??? */
  62.     unsigned char    bits;
  63.     unsigned char    numcolors;    /* color elements without alpha */
  64.     BOOL    isplanar, alpha;
  65.     NXColorSpace    cspace;
  66.     paltype    *palette;
  67.     unsigned char    memo[MAX_COMMENT];
  68. } commonInfo;
  69.  
  70. extern int get_short(FILE *);
  71. extern long get_long(FILE *);
  72. extern void put_short(int, FILE *);
  73. extern void put_long(long, FILE *);
  74. extern int byte_length(int, int);
  75. extern void errAlert(const char *, int);
  76.  
  77. extern int optimalBits(unsigned char *, int);
  78. extern int howManyBits(paltype *, int);
  79. extern BOOL isGray(paltype *, int);
  80. extern int allocImage(unsigned char **, int, int, int, BOOL);
  81. extern void expandImage(unsigned char **,
  82.     unsigned char *, paltype *, int, int, BOOL);
  83. extern void packImage(unsigned char *, unsigned char *, int, int);
  84.  
  85. #endif /* _COMMON_h_ */
  86.